package com.jumi.microservice.rocketmq;

import com.aliyun.openservices.ons.api.OnExceptionContext;
import com.aliyun.openservices.ons.api.SendCallback;
import com.aliyun.openservices.ons.api.SendResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Configuration;

/**
 * @author by mazhao
 * @Classname SendCallback
 * @Description TODO
 * @Date 2020/11/5 9:53
 */
@Configuration
public class Callback implements SendCallback {
    private static final Logger log = LoggerFactory.getLogger(Callback.class);
    @Override
    public void onSuccess(SendResult sendResult) {
        log.info("send async message success. topic=" + sendResult.getTopic() + ", msgId=" + sendResult.getMessageId());
    }

    @Override
    public void onException(OnExceptionContext context) {
        log.info("send async message failed. topic=" + context.getTopic() + ", msgId=" + context.getMessageId());
    }
}
